package _220331;

import java.util.Scanner;

/**
 * @author ShadowLim
 * @create 2022-03-31-16:40
 */
public class 循环小数 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int p = scanner.nextInt(), q = scanner.nextInt();
        String s = scanner.next();
        scanner.close();
        int len1 = p - 1;
        int len2 = q - p + 1;
        int notCircle;
        int circle = Integer.parseInt(s.substring(p - 1, q));
        if (p == 1) {
            notCircle = 0;
        } else {
            notCircle = Integer.parseInt(s.substring(0, p - 1));
        }
        System.out.println(notCircle + " " + circle);

        int up = Integer.parseInt(s.substring(0, q)) - notCircle;
        int down = 0;
        for (int i = len2; i > 0; i--) {
            down += 9 * Math.pow(10, i - 1);
        }
        down *= Math.pow(10, len1);
        System.out.println(up + " " + down);
        int r = gcd(up, down);
        up /= r;
        down /= r;
        System.out.println(up + " " + down);
    }

    private static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}
